//
//  BaseViewController.m
//  e律师
//
//  Created by 韦淋 on 2017/6/6.
//  Copyright © 2017年 test. All rights reserved.
//

#import "BaseViewController.h"


@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = YES;
    [self initalizeAppearance];
}
- (void)initalizeAppearance{
    [self.view addSubview:self.barView];
    [self.view addSubview:self.barTitleLable];
    [self.view addSubview:self.barBackButton];
    
}

#pragma mark -- ButtonTarget

- (void)action_BackButton{
    [self.navigationController popViewControllerAnimated:YES];
}


#pragma mark -- Getter/Setter

- (void)setTitle:(NSString *)title{
    [super setTitle:title];
    self.barTitleLable.text = title;
}
- (UIView *)barView{
    if (!_barView) {
        _barView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 64)];
        _barView.backgroundColor = [UIColor colorWithRed:33.0f/255.0f green:180.0f/255.0f blue:237.0f/255.0f alpha:1.0f];
    }
    return _barView;
}
- (UILabel *)barTitleLable{
    if (!_barTitleLable) {
        _barTitleLable = [[UILabel alloc]init];
        _barTitleLable.bounds = CGRectMake(0, 0, 200, 20);
        _barTitleLable.center = CGPointMake(self.barView.center.x, self.barView.center.y + 10);
        _barTitleLable.textColor = [UIColor whiteColor];
        _barTitleLable.textAlignment = NSTextAlignmentCenter;
        _barTitleLable.font = [UIFont systemFontOfSize:16];
    }
    return _barTitleLable;
}
- (UIButton *)barBackButton{
    if (!_barBackButton) {
        _barBackButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _barBackButton.frame = CGRectMake(15, 30, 25, 25);
        [_barBackButton setImage :[UIImage imageNamed:@"bann_01"] forState:UIControlStateNormal];
//        _barBackButton.backgroundColor = [UIColor redColor];
        [_barBackButton addTarget:self action:@selector(action_BackButton) forControlEvents:UIControlEventTouchUpInside];
    }
    return _barBackButton;
}

@end
